#include<bits/stdc++.h>
using namespace std;

int main()
{
	int l, r, num = 0;
	cin >> l >> r;
	for(int i=l; i<=r; i++)
	{
		int x = i;
		while(x)
		{
			if(x%10 == 2)
			{
				num++;
			}
			x /= 10;
		}
	} 
	cout << num << endl; 
	return 0;
}